<?php


namespace app\admin\model;


use think\Model;

class Foods extends Model
{
    protected $pk = 'id';
    public function getStatusAttr($value)
    {
        $status = [1=>'在售',2=>'下架'];
        return $status[$value];
    }

    public function upload($ins)
    {
        return $this->insert($ins);
    }

    public function getFinfo()
    {
    return $this->paginate(10);
    }
public function getFodetail(){
        return $this->find();
}
    public function forms(){
        return $this->hasMany('Forms','fid');
    }
public function getupFoods($id)
{
    return $this->where('id',$id)->find();
}
public function updateFood($data){
    return $this->isUpdate(true)->save($data);
}
    public function findFood($no)
    {
        return $this->where('cid',$no)->find();
    }
public function delFood($id)
{
    return $this->where('id',$id)->delete();
}


}